﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="姓名/病历号" style="width: 180px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

<script>
    var mzzybz = $.request("mzzybz");
    $(function () {
        gridList();
    })

    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/NurseManage/Allergy/GetPatientGmxxListJson",
            height: $(window).height() - 120,
            postData: { keyword: $("#txt_keyword").val() },
            colModel: [
                { label: "主键", name: "Id", hidden: true, key: true },
                { label: '过敏药品code', name: 'ypCode', hidden:true },
                { label: '姓名', name: 'xm', width: 100, align: 'left' },
                { label: '出生日期', name: 'csrq', width: 80, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' } },
                { label: '性别', name: 'sex', width: 50, align: 'left' },
                { label: '病历号', name: 'blh', width: 120, align: 'left' },
                { label: '皮试项目', name: "xmmc", width: 100, align: "left" },
                { label: '过敏类型', name: "gmlxmc", width: 100, align: "left" },
                { label: '过敏药品', name: 'gmyp', width: 100, align: 'left' },
                { label: '备注', name: 'Remark', width: 150, align: 'center' },
                { label: '创建人', name: 'CreatorName', width: 100, align: 'left' },
                { label: '创建时间', name: 'CreateTime', width: 80, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
            ],
            pager: "#gridPager",
            rowNum: '15',
            sortname: 'CreateTime desc',
            viewrecords: true,
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val()},
            }).trigger('reloadGrid');
        });
    }

    //回车事件
    $('#txt_keyword').keydownEnterEvent(function () {
        $('#btn_search').trigger('click');
    })
</script>

